<?php
class financemanagetdao extends daobase {
	public function do_getZhiChu($userNumber){
		 $sql = "select quantity from finance where user_number = '$userNumber' and fx ='0'";
		 $result = $this->fetchit($sql);
		 $zhiChu = 0;
		 foreach ($result as $values){
		 	$values = floatval($values[0]);
		 	$zhiChu +=$values;
		 }
		 return $zhiChu;
	}
	public function do_getShoRu($userNumber){
		$sql = "select quantity from finance where user_number = '$userNumber' and fx ='1'";
		 $result = $this->fetchit($sql);
		 $shouRu = 0;
		 foreach ($result as $values){
		 	$values = floatval($values[0]);
		 	$shouRu +=$values;
		 }
		 return $shouRu;
	}
	 public function do_getZhiChuKinds($userNumber){
		$sql = "select  DISTINCT kind from finance where user_number = '$userNumber' and fx ='0'";
		 $result = $this->fetchit($sql);
		 $zhichukinds = "";
		 $i=0;
		 foreach ($result as $values){
		 	 $zhichukinds[$i] = $values[0];
			 $i++;
		 }
		 return $zhichukinds;
	}
	public function do_getShouRuKinds($userNumber){
		$sql = "select  DISTINCT kind from finance where user_number = '$userNumber' and fx ='1'";
		//echo $sql;
		 $result = $this->fetchit($sql);
		 $shourukinds = "";
		$i=0;
		 foreach ($result as $values){
		 	 $shourukinds[$i] = $values[0];
			 $i++;
		 }
		 return $shourukinds;
	}
	 
}
?>
